#!/usr/bin/python3
from transforms3d import euler
#pip3 install transforms3d 需要安装


def main():
    # 欧拉角 -> 四元数
    roll, pitch, yaw = 0.0, 0.0,-3.1415926  # 弧度
    quaternion = euler.euler2quat(roll, pitch, yaw)
    print("四元数:", quaternion)

    # 四元数 -> 欧拉角
    res = euler.quat2euler(quaternion)
    print("欧拉角:", res)

if __name__ == '__main__':
    main()

